home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NOVA - For the NeXT Workstation
/
NOVA - For the NeXT Workstation.iso
/
SourceCode
/
GaugesDemo
/
ValuatorGauge.m
< prev
Wrap
Text File
|
1992-12-19
|
2KB
|
67 lines
/* Generated by Interface Builder */
#import "ValuatorGauge.h"
@implementation ValuatorGauge
+ newFrame: (NXRect *) r
{
self = [super newFrame:r];
return self;
}
#define POINTWIDTH 0.05 /* 5% of the scale */
-drawSelf:(NXRect *)drawRects :(int)rectCount
{
NXRect dataRect;
dataRect = FaceRect;
PScomposite(0.0,0.0,bounds.size.width,bounds.size.height,
GaugeDat.bmgState,0.0, 0.0,NX_COPY);
/* now draw the pointer */
PSsetgray(GaugeDat.ptGray);
if (NX_WIDTH(&bounds) > NX_HEIGHT(&bounds)){
/* do horizontal pointer */
NX_X(&dataRect) += (((GaugeDat.value - GaugeDat.startValue)
/ GAUGESIZE)
* NX_WIDTH(&dataRect) -
(NX_WIDTH(&FaceRect) * POINTWIDTH / 2));
dataRect.size.width = (NX_WIDTH(&FaceRect) * POINTWIDTH);
}else{
/* do vertical pointer */
NX_Y(&dataRect) += (((GaugeDat.value - GaugeDat.startValue)
/ GAUGESIZE)
* NX_HEIGHT(&dataRect) -
(NX_HEIGHT(&FaceRect) * POINTWIDTH / 2));
dataRect.size.height = (NX_HEIGHT(&FaceRect) * POINTWIDTH);
}
if (GaugeFlags.borderType == NX_NOBORDER) {
if (GaugeFlags.labelTicsOn){
PSsetlinewidth(1.0);
if (NX_WIDTH(&bounds) > NX_HEIGHT(&bounds)){
PSmoveto(NX_X(&dataRect),NX_MAXY(&dataRect));
PSlineto(NX_MAXX(&dataRect),NX_MAXY(&dataRect));
PSlineto(NX_X(&dataRect)+NX_WIDTH(&dataRect)/2.,
NX_Y(&dataRect));
PSfill();
}else{
PSmoveto(NX_MAXX(&dataRect),NX_MAXY(&dataRect));
PSlineto(NX_MAXX(&dataRect),NX_Y(&dataRect));
PSlineto(NX_X(&dataRect),
NX_Y(&dataRect)+(NX_HEIGHT(&dataRect)/2.));
PSfill();
}
}else NXRectFill(&dataRect);
if (GaugeFlags.overFlow) NXHighlightRect(&bounds);
return self; /* exit quick */
}
PSsetgray(GaugeDat.ticGray);
FancyRect(&dataRect);
if (GaugeFlags.overFlow) NXHighlightRect(&bounds);
return self;
}
@end